<script type="text/javascript" src="${webctx}/resources/js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/jquery-weui.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/obz.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/city-picker.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/jquery.lSelect.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/swiper.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/fastclick.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/json2.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/template.js"></script>
<script type="text/javascript" src="${webctx}/resources/js/public.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    function formatTemplate(dta, tmpl) {
        var format = {
            name: function (x) {
                return x
            }
        };
        return tmpl.replace(/{(\w+)}/g, function (m1, m2) {
            if (!m2)
                return "";
            return (format && format[m2]) ? format[m2](dta[m2]) : dta[m2];
        });
    }

    var Template = {
        selectMenu: function (menu) {
            if (menu) {
                $("#menu-items").children("a").removeClass("weui_bar_item_on");
                $(menu).addClass("weui_bar_item_on");
            }
        },
        init: function (menu) {
            Template.selectMenu(menu);
        }
    }

        [#if timestamp ? ?]
    wx.config({
        //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '${appId}', // 必填，公众号的唯一标识
        timestamp: ${timestamp}, // 必填，生成签名的时间戳
        nonceStr: '${nonceStr}', // 必填，生成签名的随机串
        signature: '${signature}',// 必填，签名，见附录1
        jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone',
            'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem', 'translateVoice', 'startRecord',
            'stopRecord', 'onVoiceRecordEnd', 'playVoice', 'onVoicePlayEnd', 'pauseVoice', 'stopVoice', 'uploadVoice', 'downloadVoice',
            'chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'getNetworkType', 'openLocation', 'getLocation',
            'hideOptionMenu', 'showOptionMenu', 'closeWindow', 'scanQRCode', 'chooseWXPay',
            'openProductSpecificView', 'addCard', 'chooseCard', 'openCard'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });
    //wx.ready(function(){
    //config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，
    //config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，
    //则须把相关接口放在ready函数中调用来确保正确执行。
    //对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
    //});
    wx.error(function (res) {
        for (var key in res) {
            alert(res[key]);
        }
    });
    [/#if]

        $(document).ready(function () {
            $("#search_input").click(function () {
                location.href = "${webctx}/search"
            });
            FastClick.attach(document.body);
        });
</script>